#ifndef ___INC_QGDSHOW_H__
#define ___INC_QGDSHOW_H__

#ifdef _MSC_VER
#pragma once
#endif

//////////////////////////////////////////////////////////////////////////
// WARNING: this header is for windows. and only you can use when 
// library built with '_QG_USE_DSHOW=1', settled in 'qg_config.h'
//
// this header is not default include item in 'qg.h'

#if _SB_WINDOWS_

//////////////////////////////////////////////////////////////////////////
// definitions

// play state
enum qgDshowState
{
	QGDSHOW_STATE_STOP,
	QGDSHOW_STATE_PLAY,
	QGDSHOW_STATE_PAUSE,
};


//////////////////////////////////////////////////////////////////////////
// direct show media

//
#define QGDSHOWMEDF_FMT32			0x0001

//
class KAPI qgDshowMedia : public qgObj
{
	KCH_SUBCLASS(qgDshowMedia, qgObj);
	KCH_INTERN(ReqData);
	KT_DECL_TYPE_INIT(qgDshowMedia);

protected:
	ReqData*			_req;

	qgDshowState		_state;
	bool				_hasvideo;
	bool				_hasaudio;

	bool				_loop;

	qgTexture*			_texhold;

protected:
	qgDshowMedia();
	~qgDshowMedia();

public:
	virtual bool Open(const char* filename);
	virtual bool OpenL(const kwchar* filename);
	virtual bool Close();

	virtual bool Play(bool isplay = true);
	virtual bool Stop(bool isstop = true);
	virtual bool Pause();

	qgDshowState GetState() { return _state; }
	bool HasVideo() { return _hasvideo; }
	bool HasAudio() { return _hasaudio; }
	bool IsLoop() { return _loop; }

	virtual kint GetVideoWidth();
	virtual kint GetVideoHeight();
	virtual klong GetLength();
	virtual klong GetPosition();
	virtual void SetPosition(klong pos);
	virtual void TurnLoop(bool isloop);

	virtual bool Update();
	virtual qgTexture* GetTexture(bool use_hold_as_possible = false);

	void SetHoldTexture(qgTexture* tex);
	qgTexture* GetHoldTexture();
	bool HasHoldTexture() { return _texhold != NULL; }

public:
	static qgDshowMedia* New(kint flags, const char* filename = NULL);
};

#endif	// _SB_WINDOWS_

#endif	// ___INC_QGDSHOW_H__
